package com.kang.controller;

import com.github.pagehelper.PageInfo;
import com.kang.bean.News;
import com.kang.commons.Result;
import com.kang.dto.NewsDto;
import com.kang.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: service
 * @description: 消息控制类
 * @author: K.faWu
 * @create: 2022-04-19 16:21
 **/
@RestController
@RequestMapping("news")
public class NewsController {
    @Autowired
    private NewsService newsService;

    @PostMapping("/getList")
    public Result<?> getList(@RequestBody NewsDto newsDto, Pageable page, HttpServletRequest request){
        PageInfo<News> pageInfo = newsService.getList(newsDto, page, request);
        return Result.success(pageInfo);
    }
}
